import Vue from 'vue'
import Vuex from 'vuex'

import HotelMain from './wangmzVuex/moudules/HotelMain'
Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    token: JSON.parse(localStorage.getItem("token")) || "",
    userInfo: JSON.parse(localStorage.getItem("userInfo")) || {}
  },
  getters: {
  },
  mutations: {
    SET_USERINFO: (state, userInfo) => {
      state.userInfo = userInfo
      localStorage.setItem("userInfo", JSON.stringify(userInfo))
    },
    SET_TOKEN: (state, token) => {
      state.token = token
      localStorage.setItem("token", JSON.stringify(token))
    }
  },
  actions: {
  },
  modules: {
    HotelMain,
  }
})
